<?php
namespace app\common\validate;

use think\Validate;

class ApplyValidate extends Validate
{
    protected $rule =   [
        'page|页数'            => 'require|integer',
        'limit|条数'           => 'require|integer',
        'id'                   => 'require|integer',
        'door_img|门头照'      => 'require',
        'user_id|用户ID'       => 'require|integer',
        'real_name|真实姓名'   => 'require|length:1,50',
        'card_id|身份证号'     => 'require|length:1,50',
        'address|地址'         => 'require|length:1,255',
        'back_msg|驳回理由'    => 'require|length:1,100',
    ];
    
    protected $scene = [
        /** api */
        'add'        => ['door_img', 'card_id', 'user_id', 'real_name', 'address'],
        'show_api'   => ['user_id'],

        /** admin */
        'list'      => ['page', 'limit'],
        'show'      => ['id'],
        'back'      => ['id', 'back_msg'],
    ];
}